package org.easystub;

import java.util.Map;
import java.util.HashMap;

public class CaptureStore {

    private final Map<Invocation, Capture> invocationToCallback = new HashMap<Invocation, Capture>();

    public void registerCallbackForInvocation(Invocation invocation, Capture callback) {
        invocationToCallback.put(invocation,  callback);
    }

    public boolean isCapturingInvocation(Invocation invocation) {
        return invocationToCallback.containsKey(invocation);
    }

    public void capture(Invocation invocation) {
        invocationToCallback.get(invocation).handleInvocation(invocation);
    }
}
